package com.geovis.boot.service.demo.file.serviceimpl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.geovis.boot.service.demo.file.entity.SysUser;
import com.geovis.boot.service.demo.file.mapper.UserMapper;
import com.geovis.boot.service.demo.file.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * (SysUser)表服务实现类
 *
 * @author makejava
 * @since 2020-10-29 14:23:27
 */
@Service("userService")
@Component
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param user_id 主键
     * @return 实例对象
     */
    @Override
    public SysUser queryById(Integer user_id) {
        return userMapper.selectById(user_id);
    }


    @Override
    public SysUser queryByUserName(String userName) {
        QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
        wrapper.eq("user_name", userName);
        SysUser sysUser = userMapper.selectOne(wrapper);
        return sysUser;
    }



}